package com.howcan.adapter;

import android.os.Parcel;
import android.os.Parcelable;
import java.util.Arrays;
import java.util.List;

public abstract class ResultList<T extends Parcelable>
  implements Parcelable
{
  protected String emptyMsg;
  protected boolean isEnd;
  protected T[] list;
  protected int nextStartIndex;
  protected int recordCount;
  protected int startIndex;

  public ResultList()
  {
  }

  public ResultList(int paramInt1, int paramInt2, int paramInt3, boolean paramBoolean, T[] paramArrayOfT)
  {
    this.recordCount = paramInt1;
    this.startIndex = paramInt2;
    this.nextStartIndex = paramInt3;
    this.isEnd = paramBoolean;
    this.list = paramArrayOfT;
  }

  public ResultList(int paramInt1, int paramInt2, boolean paramBoolean, T[] paramArrayOfT)
  {
    this.recordCount = paramInt1;
    this.startIndex = paramInt2;
    this.isEnd = paramBoolean;
    this.list = paramArrayOfT;
  }

  protected ResultList(Parcel paramParcel)
  {
    this.recordCount = paramParcel.readInt();
    this.startIndex = paramParcel.readInt();
    this.nextStartIndex = paramParcel.readInt();
    if (paramParcel.readInt() == 1) this.isEnd = true;
    this.emptyMsg = paramParcel.readString();
   return;
  }

 
  public int describeContents()
  {
    return 0;
  }

  public String emptyMsg()
  {
    return this.emptyMsg;
  }

  public boolean isEnd()
  {
    return this.isEnd;
  }

  public T[] list()
  {
    return this.list;
  }

   public int nextStartIndex()
  {
//    if (!this.isEnd))
      if (this.list != null) 
    	  return startIndex + list.length;
      else
    	  return this.nextStartIndex;    
  }

  public int recordCount()
  {
    return this.recordCount;
  }

  public int startIndex()
  {
    return this.startIndex;
  }

  public String toString()
  {
    StringBuilder localStringBuilder1 = new StringBuilder();
    localStringBuilder1.append("result: ");
    localStringBuilder1.append("recordCount = ").append(this.recordCount);
    localStringBuilder1.append(", startIndex = ").append(this.startIndex);
    localStringBuilder1.append(", nextStartIndex = ").append(this.nextStartIndex);
    if (this.isEnd)
        localStringBuilder1.append(", EOF");
    else {
        StringBuilder localStringBuilder2 = localStringBuilder1.append(", list = ");
        String str;
    	if (this.list == null) 
            str = "null";
        else str = this.list.length + " objects";
        localStringBuilder2.append(str);
        localStringBuilder1 = localStringBuilder2;
    }
    return localStringBuilder1.toString();
    
  }

  public void writeToParcel(Parcel paramParcel, int paramInt)
  {
    paramParcel.writeInt(this.recordCount);
    paramParcel.writeInt(this.startIndex);
    paramParcel.writeInt(this.nextStartIndex);
    if (this.isEnd)
    {
      paramParcel.writeInt(1);
      paramParcel.writeString(this.emptyMsg);
    }
    List localList = null;
    if (list != null) localList = Arrays.asList(this.list);
    paramParcel.writeList(localList);
    return;
  }
}
